package com.bingxue.edu.common.enums;

import com.bingxue.edu.framework.enums.Dict;
import com.bingxue.edu.framework.enums.DictEnum;
import com.bingxue.edu.framework.exception.SystemException;
import com.fasterxml.jackson.annotation.JsonValue;
import com.mybatisflex.annotation.EnumValue;
import lombok.AllArgsConstructor;
import lombok.Getter;

@Getter
@AllArgsConstructor
@Dict("题目类型")
public enum QuestionTypeEnum implements DictEnum<Integer> {
    SINGLE(1, "单选题"),
    MULTI(2, "多选题"),
    TOF(3, "判断题"),
    TKT(4, "填空题"),
    JST(5, "计算题"),
    WDT(6, "解答题");

    @EnumValue
    @JsonValue
    private final Integer value;
    private final String label;



    // 根据 label 获取枚举值
    public static QuestionTypeEnum getByLabel(String label) {
        for (QuestionTypeEnum type : QuestionTypeEnum.values()) {
            if (type.getLabel().equalsIgnoreCase(label)) {
                return type;
            }
        }
        return  null;
    }
}